import torch 
from torchsummary import summary
from unet import UNet
from glob import glob
import torch.nn as nn
from dice_loss import dice_coeff, DiceCoeff
from hubconf import unet_carvana
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
from predict import predict_img 
from PIL import Image
import matplotlib.pyplot as plt 
from torch.utils.tensorboard import SummaryWriter

import tensorwatch as tw
 


if __name__ == "__main__":

    # 其实就两句话
    model=UNet(3, 1)
    tw.draw_model(model, [1, 3, 256, 256])


    # model = unet_carvana(pretrained=True, device="cpu")
    
    # img_url = glob("./data/imgs/0cdf5b5d0ce1_01.jpg")
    # img = Image.open(img_url[0])

    # res = predict_img(model, img, device="cpu", scale_factor=0.5)
    # print(res.shape)
    # plt.imshow(res)
    # plt.show()


    # print(model)

    # 测试tensorboard 使用
    # writer = SummaryWriter("./log/")
    # loss = 0
    # for epoch in range(100):
    #     loss = loss + 0.1
    #     writer.add_scalar('mAP', loss, epoch)
    